﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;

namespace Assets._Script.Entity
{
    //抽象基类 Pet
    public abstract class Pet
    {
        //私有静态字段，用作存放宠物总个数
        private static int _amount;
        //静态的属性，用来作为 静态字段 _amount 的取值器和赋值器
        public static int Amount { get => _amount; set => _amount = value; }


        private string _name;
        private string _type;
        private int _age;
        private string _color;

        public string Name { get => _name; set => _name = value; }
        public string Type { get => _type; set => _type = value; }
        public int Age { get => _age; set => _age = value; }
        public string Color { get => _color; set => _color = value; }
       

        public Pet(string name, string type, int age, string color)
        {
            Name = name;
            Type = type;
            Age = age;
            Color = color;
            Pet._amount++;
        }
        public Pet() { }

        //抽象方法 嚎叫
        public abstract void Cry();

        /// <summary>
        ///  用来输出当前宠物总个数的静态方法
        /// </summary>
        public static void Count() {
            Debug.Log($"当前宠物总数: {Pet.Amount}");
        }
    }
}
